
import 'package:du_application/model/GoodsModel.dart';
import 'package:du_application/pages/detail/DetailBuyBar.dart';
import 'package:du_application/provide/GoodsProvider.dart';
import 'package:flutter/material.dart';
import 'package:provide/provide.dart';



class DetailBottomBar extends StatelessWidget {
     
  final List<ProductList> productList;
  final int userHasCollect;
  const DetailBottomBar({Key key,this.productList,this.userHasCollect}) : super(key: key);
// productList
  @override
  Widget build(BuildContext context) {

    return BottomAppBar(
      child: Container(
          padding: EdgeInsets.symmetric(horizontal: 20),
          height: 50,
          child: Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            crossAxisAlignment: CrossAxisAlignment.center,
            children: <Widget>[
              
            InkWell(
              onTap: (){
                Provide.value<GoodsProvider>(context).collet();
            },
              child: Column(
                mainAxisAlignment: MainAxisAlignment.center,
                children: <Widget>[
                 userHasCollect==0?Icon(Icons.star_border):Icon(Icons.star,color: Colors.yellow,),
                  Text(
                    userHasCollect==0?"收藏":"取消收藏",
                    style: TextStyle(fontSize: 8),
                  )
                ],
              )
            ),
              RaisedButton(
                textColor: Colors.white,
                splashColor: Color.fromRGBO(255, 255, 255, 0.5),
                colorBrightness: Brightness.light,
                padding: EdgeInsets.symmetric(horizontal: 50),
                color: Colors.cyan[400],
                child: Text("立即购买"),
                onPressed: () {
                  showModalBottomSheet(
                      shape: RoundedRectangleBorder(
                          borderRadius: BorderRadiusDirectional.circular(10)),
                      context: context,
                      builder: (_) {
                        return DetailBuyBar(productList:productList);
                      });
                },
              ),
            ],
          )
          ),
    );

  }
 
}
